package com.hong.pdf2img.utils;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class AppLogger {

    private static final Logger logger = LoggerFactory.getLogger(AppLogger.class);

    // 不同级别的日志方法
    public static void debug(String message) {
        logger.debug(message);
    }

    public static void info(String message) {
        logger.info(message);
    }

    public static void warn(String message) {
        logger.warn(message);
    }

    public static void error(String message) {
        logger.error(message);
    }

    public static void error(String message, Throwable throwable) {
        logger.error(message, throwable);
    }

    // 带格式的日志
    public static void info(String format, Object... args) {
        logger.info(format, args);
    }

    // 性能监控
    public static void logPerformance(String operation, long startTime) {
        long duration = System.currentTimeMillis() - startTime;
        if (duration > 1000) {
            logger.warn("{} 耗时: {}ms", operation, duration);
        } else {
            logger.info("{} 耗时: {}ms", operation, duration);
        }
    }
}
